package acn.spring.service;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.transaction.annotation.Transactional;

import acn.spring.domain.Category;
import acn.spring.domain.Customer;
import acn.spring.domain.Order;
import acn.spring.domain.Product;
import acn.spring.domain.ProductOrder;

@Transactional
@EnableGlobalMethodSecurity(securedEnabled = true)
public interface ShopService extends UserDetailsService {

	// Product

	List<Product> getAllProducts();

	Page<Product> getAllProducts(Pageable pageable);

	Product addProduct(Product product);

	Page<Product> getProducts(Category category, Pageable pageable);

	List<Product> getProducts(String name);

	Product getProduct(long id);

	void deleteProduct(long id);

	void deleteAllProducts();

	void saveProduct(Product product);

	List<Product> findTopFiveBestSeller();

	Page<Product> findBestSellerProductsByCategory(Category category, Pageable pageable);

	// Order

	Order getOrder(long id);

	List<Order> getAllOrders();

	Order addOrder(Order order);

	void saveOrder(Order order);

	// Category

	Category getCategory(String name);

	List<Category> getAllCategories();

	// ProductOrder

	List<ProductOrder> getProductOrders(Product product);

	List<ProductOrder> getAllProductOrders();

	// Customer

	Customer getCustomer(long id);

}
